// 使用apply方法
const library = new Library();
library.addBook = (book) => {
  library.availableBooks.push(book);
};
library.borrowBook = (book) => {
  library.borrowedBooks.push(book);
  book.borrow();
};
library.returnBook = (book) => {
  library.borrowedBooks = library.borrowedBooks.filter(b => b !== book);
  book.return();
};

// 使用unapply方法
library.addBook = (book) => {
  library.availableBooks.push(book);
};
library.borrowBook = (book) => {
  library.borrowedBooks.push(book);
  book.borrow();
};
library.returnBook = (book) => {
  library.borrowedBooks = library.borrowedBooks.filter(b => b !== book);
  book.return();
};
